<template>
   
  <div>
    <el-row class="but">
      <el-button type="primary" size="small" @click="oppens.ones = true"
        >添加</el-button
      >
      <el-button type="warning" size="small">批量删除</el-button>
    </el-row>
    <!-- -----表格 -->
    <ope-rate
      :roleList="roleList"
      :oppens="oppens"
      @bj="bjs"
      @removes="del"
    ></ope-rate>
    <sheet ref="formseed" :oppens="oppens"></sheet>
  </div>
</template>

<script>
import opeRate from "../role/seed/operate.vue";
import sheet from "./seed/sheet.vue";

export default {
  data() {
    return {
      roleList: [],
      oppens: {
        ones: false,
      },
    };
  },
  methods: {
    // 编辑
    bjs(row) {
      console.log(row);
      this.$refs.formseed.form = JSON.parse(JSON.stringify(row));
      this.oppens.ones = true;
    },
    //删除
    del(id) {
      this.$api.roleDel({ id: id }).then((res) => {
        this.$message({
          message: "角色删除成功",
          type: "success",
        });
        this.$router.go(0)
      });
    },
  },
  created() {
    this.$api
      .reqRole()
      .then((res) => {
        console.log(res);
        this.roleList = res.data.list;
      })
      .catch((err) => console.log(err));
  },
  mounted() {},
  components: {
    opeRate,
    sheet,
  },
  compute() {},
  watch: {},
};
</script>

<style lang='scss' scoped>
.but {
  margin: 10px 0;
}
</style>
